home *** CD-ROM | disk | FTP | other *** search
/ Revista CD Expert 8 / Revista CD Expert nº 08 CD1.iso / Utilitarios / Programacao / MS-DOS Interrupt List / inter60g / INT2TPH.ZIP / INT2TPH.PAS < prev    next >
Pascal/Delphi Source File  |  1997-07-07  |  63KB  |  1,598 lines

  1. { INT2Tph. Main module for the Interrupt List -> .TPH compiler.}
  2. { The software included, data formats and basic algorithms are }
  3. { copyright (C) 1996 by Slava Gostrenko. All rights reserved.  }
  4.  
  5. {$M 16384}
  6. {$IFNDEF DPMI}
  7.   ! set Target to 'Protected Mode Application'
  8. {$ENDIF}
  9.  
  10. {$X+}
  11. program
  12.   Int2TPH;
  13.  
  14. uses
  15.   Upcaser, Objects, TPH;
  16.  
  17. type
  18.   PString32 = ^TString32;
  19.   TString32 = string [32];
  20.  
  21. const
  22.   ExtendedIndex: Boolean = True;
  23.  
  24. var
  25.   FO: THelpFile;
  26.   IncompPattern: Text;
  27.   HdrS: TStringCollection;
  28.   IntLists: array [Byte] of PTopic;
  29.   IntNames: array [Byte] of string [12];
  30.   KeyLists: TCollection;
  31.   KeyNames: TCollection;
  32.   IntList: PTopic;
  33.   IntListName: string;
  34.   Tables: PTopic;
  35.   TablesName: string;
  36.   CMOS: PTopic;
  37.   CMOSName: string;
  38.   FARCall: PTopic;
  39.   FARCallName: string;
  40.   Memory: PTopic;
  41.   MemoryName: string;
  42.   MSR: PTopic;
  43.   MSRName: string;
  44.   OpCodes: PTopic;
  45.   OpCodesName: string;
  46.   Ports: PTopic;
  47.   PortsName: string;
  48.  
  49.   IntListIndex: PTopic;
  50.   IntListIndexName: string;
  51.  
  52. const HexCh: array [0..$F] of Char = '0123456789ABCDEF';
  53. function HexWord (W: Word): string;
  54. begin
  55.   HexWord := HexCh[Hi(W) shr 4] + HexCh[Hi(W) and $F]
  56.            + HexCh[Lo(W) shr 4] + HexCh[Lo(W) and $F];
  57. end;
  58. function HexByte (B: Byte): string;
  59. begin
  60.   HexByte := HexCh[B shr 4] + HexCh[B and $F];
  61. end;
  62.  
  63. function MemInitSwapFile(FileName: PChar; FileSize: Longint): Integer; far; external 'RTM' Index 35;
  64. function MemCloseSwapFile(Delete: Integer): Integer; far; external 'RTM' Index 36;
  65.  
  66. function MakeCorrectTopicName (const TopicName: string): string;
  67. var
  68.   I: Integer;
  69.   V: Integer;
  70.   AddChar, TstTopic: string;
  71.   Rez: string;
  72. begin
  73.   Rez := TopicName;
  74.  
  75.   if Length (Rez) > 31 then
  76.     Rez [0] := #31;
  77.  
  78.   V := 0;
  79.  
  80.   if Length (Rez) = 31 then
  81.     AddChar := '   '
  82.   else
  83.   if Length (Rez) = 30 then
  84.     AddChar := '  '
  85.   else
  86.   if Length (Rez) = 29 then
  87.     AddChar := ' '
  88.   else
  89.     AddChar := '';
  90.  
  91.   TstTopic := StUpcase2 (Rez);
  92.   while Hdrs. Search (@TstTopic, I) do begin
  93.     Dec (Rez [0], Length (AddChar));
  94.     Inc (V);
  95.     if V > 99 then
  96.       WriteLn ('error 3');
  97.  
  98.     System. Str (V, AddChar);
  99.     if Length (AddChar) = 1 then
  100.       AddChar := '_0' + AddChar
  101.     else
  102.       AddChar := '_'  + AddChar;
  103.  
  104.     Rez := Rez + AddChar;
  105.     TstTopic := StUpcase2 (Rez);
  106.   end;
  107.  
  108.   Hdrs. Insert (NewStr (TstTopic));
  109.  
  110.   MakeCorrectTopicName := Rez;
  111. end;
  112.  
  113. function ProcessPattern (var Str: string; var Pos: Integer;
  114.                          Pattern: string; Keyword: string;
  115.                          Topic: PTopic; StepBack: Integer): Boolean;
  116. var I, J: Integer;
  117. begin
  118.   I := 1;
  119.   while I <= Length (Pattern) do begin
  120.     if Pattern [I] in [#3, #6] then
  121.       if Upcase [Str [Pos + I - 1]] in HexChars + ['X'] then begin
  122.         J := System. Pos (#3, Keyword);
  123.         if J > 0 then
  124.           Keyword [J] := Str [Pos + I - 1]
  125.         else
  126.           if Pattern [I] = #3 then begin
  127.             WriteLn (Str);
  128.             WriteLn ('error in keyword pattern (1) ', Pattern, ' ', Keyword);
  129.             ProcessPattern := False;
  130.             Exit;
  131.           end;
  132.       end else begin
  133.         ProcessPattern := False;
  134.         Exit;
  135.       end
  136.     else
  137.     if Pattern [I] in [#4, #7] then begin
  138.       if (  (Upcase [Str [Pos + I - 1]] in ['B', 'C', 'D'])
  139.         and (Upcase [Str [Pos + I]] in ['X', 'L', 'H']))
  140.       or (  (Upcase [Str [Pos + I - 1]] in ['S', 'D'])
  141.         and (Upcase [Str [Pos + I]] = 'I'))
  142.       or (  (Upcase [Str [Pos + I - 1]] in ['B', 'S'])
  143.         and (Upcase [Str [Pos + I]] = 'P'))
  144.       or (  (Upcase [Str [Pos + I - 1]] in ['D', 'E', 'S', 'F', 'G'])
  145.         and (Upcase [Str [Pos + I]] = 'S'))
  146.       or (  (Upcase [Str [Pos + I - 1]] = 'S')
  147.         and (Upcase [Str [Pos + I]] = 'F'))
  148.       or (  (Upcase [Str [Pos + I - 1]] = 'V')
  149.         and (Upcase [Str [Pos + I]] = 'X'))
  150.       then begin
  151.         J := System. Pos (#4, Keyword);
  152.         if J > 0 then begin
  153.           Keyword [J] := Str [Pos + I - 1];
  154.           Keyword [J + 1] := Str [Pos + I];
  155.           Inc (I);
  156.         end else
  157.           if Pattern [I] = #4 then begin
  158.             WriteLn (Str);
  159.             WriteLn ('error in keyword pattern (2) ', Pattern, ' ', Keyword);
  160.             ProcessPattern := False;
  161.             Exit;
  162.           end else
  163.             Inc (I);
  164.       end else begin
  165.         ProcessPattern := False;
  166.         Exit;
  167.       end
  168.     end else
  169.     if Pattern [I] in [#5, #8] then begin
  170.       if (  (Upcase [Str [Pos + I - 1]] in ['B', 'C', 'D'])
  171.         and (Upcase [Str [Pos + I]] in ['X', 'L', 'H']))
  172.       or (  (Upcase [Str [Pos + I - 1]] = 'S')
  173.         and (Upcase [Str [Pos + I]] = 'F'))
  174.       or (  (Upcase [Str [Pos + I - 1]] = 'V')
  175.         and (Upcase [Str [Pos + I]] = 'X'))
  176.       then begin
  177.         J := System. Pos (#5, Keyword);
  178.         if J > 0 then begin
  179.           Keyword [J] := Str [Pos + I - 1];
  180.           Keyword [J + 1] := Str [Pos + I];
  181.           Inc (I);
  182.         end else
  183.           if Pattern [I] = #5 then begin
  184.             WriteLn (Str);
  185.             WriteLn ('error in keyword pattern (3) ', Pattern, ' ', Keyword);
  186.             ProcessPattern := False;
  187.             Exit;
  188.           end else
  189.             Inc (I);
  190.       end else begin
  191.         ProcessPattern := False;
  192.         Exit;
  193.       end
  194.     end else
  195.     if ((Pattern [I] = 'X') and (Upcase [Str [Pos + I - 1]] in ['L', 'H']))
  196.     or ((Pattern [I] in ['L', 'H']) and (Upcase [Str [Pos + I - 1]] = 'X'))
  197.     then
  198.       {Ok}
  199.     else
  200.     if Pattern [I] = 'H' then begin
  201.       if Upcase [Str [Pos + I - 1]] <> 'H' then begin
  202.         Delete (Pattern, I, 1);
  203.         Dec (I);
  204.       end;
  205.     end else
  206.     if Upcase [Str [Pos + I - 1]] <> Upcase [Pattern [I]] then begin
  207.       ProcessPattern := False;
  208.       Exit;
  209.     end;
  210.  
  211.     Inc (I);
  212.   end;
  213.  
  214.   {Once user's request for pattern with helper was confirmed}
  215.   {make the pattern suitable for helper string analizis.    }
  216.   if Pattern [Length (Pattern)] = '"' then
  217.     Dec (Pattern [0]);
  218.  
  219.   if  (Pos + Length (Pattern) - 1 > Length (Str))
  220.   and (Pattern [Length (Pattern)] in ['h', 'H']) then
  221.     Dec (Pattern [0]);
  222.  
  223.   if Pos + Length (Pattern) - 1 <= Length (Str) then begin
  224.     if (System. Pos (#3, Keyword) > 0)
  225.     or (System. Pos (#4, Keyword) > 0)
  226.     or (System. Pos (#5, Keyword) > 0) then begin
  227.       WriteLn (Str);
  228.       WriteLn ('error in keyword pattern (4) ', Pattern, ' ', Keyword);
  229.     end;
  230.  
  231.     if  (Length (Keyword) < 13)
  232.     and (Pos + Length (Pattern) <= Length (Str))
  233.     and (Str [Pos + Length (Pattern)] in (['/', 'h', 'H', ':', '-'] + HexChars))
  234.     and (Pos + Length (Pattern) + 1 <= Length (Str))
  235.     and (not (Str [Pos + Length (Pattern) + 1] in ['I', 'R', 'W', '-', ' ']))
  236.     then begin
  237.       WriteLn (IncompPattern, Str);
  238.       WriteLn (IncompPattern, 'not a complete pattern ', Pattern, ' for keyword ', Keyword);
  239.     end;
  240.  
  241.     if  (Pos + Length (Pattern) <= Length (Str))
  242.     and (Str [Pos + Length (Pattern)] = '"') then begin
  243.       Keyword := Keyword + '"';
  244.       I := Pos + Length (Pattern) + 1;
  245.       while (I <= Length (Str)) and (Str [I] <> '"') do begin
  246.         Keyword := Keyword + Str [I];
  247.         Inc (I);
  248.       end;
  249.       if I <= Length (Str) then begin
  250.         Keyword := Keyword + '"';
  251.         if Copy (Keyword, 1, 4) = 'INT ' then
  252.           Delete (Keyword, 1, 4);
  253.       end else
  254.         Delete (Keyword, System.Pos ('"', Keyword), Length (Keyword));
  255.     end;
  256.  
  257.     Topic^. AddKeyword (Keyword, StepBack);
  258.     Insert (#2, Str, Pos + Length (Pattern));
  259.     Insert (#2, Str, Pos);
  260.     Inc (Pos, Length (Pattern) + 1);
  261.  
  262.     ProcessPattern := True;
  263.   end else
  264.     ProcessPattern := False;
  265. end;
  266.  
  267. function SkipPattern (var Str: string; var Pos: Integer;
  268.                       Pattern: string): Boolean;
  269. var I, J: Integer;
  270. begin
  271.   I := 1;
  272.   while I <= Length (Pattern) do begin
  273.     if Pattern [I] = #3 then
  274.       if Upcase [Str [Pos + I - 1]] in HexChars + ['X'] then begin
  275.         {Ok}
  276.       end else begin
  277.         SkipPattern := False;
  278.         Exit;
  279.       end
  280.     else
  281.     if Pattern [I] = #4 then begin
  282.       if (  (Upcase [Str [Pos + I - 1]] in ['B', 'C', 'D'])
  283.         and (Upcase [Str [Pos + I]] in ['X', 'L', 'H']))
  284.       or (  (Upcase [Str [Pos + I - 1]] in ['S', 'D'])
  285.         and (Upcase [Str [Pos + I]] = 'I'))
  286.       or (  (Upcase [Str [Pos + I - 1]] in ['B', 'S'])
  287.         and (Upcase [Str [Pos + I]] = 'P'))
  288.       or (  (Upcase [Str [Pos + I - 1]] in ['D', 'E', 'S', 'F', 'G'])
  289.         and (Upcase [Str [Pos + I]] = 'S'))
  290.       or (  (Upcase [Str [Pos + I - 1]] = 'S')
  291.         and (Upcase [Str [Pos + I]] = 'F'))
  292.       or (  (Upcase [Str [Pos + I - 1]] = 'V')
  293.         and (Upcase [Str [Pos + I]] = 'X'))
  294.       then begin
  295.         {Ok}
  296.       end else begin
  297.         SkipPattern := False;
  298.         Exit;
  299.       end
  300.     end else
  301.     if Pattern [I] = #5 then begin
  302.       if (  (Upcase [Str [Pos + I - 1]] in ['B', 'C', 'D'])
  303.         and (Upcase [Str [Pos + I]] in ['X', 'L', 'H']))
  304.       or (  (Upcase [Str [Pos + I - 1]] = 'S')
  305.         and (Upcase [Str [Pos + I]] = 'F'))
  306.       or (  (Upcase [Str [Pos + I - 1]] = 'V')
  307.         and (Upcase [Str [Pos + I]] = 'X'))
  308.       then begin
  309.         {Ok}
  310.       end else begin
  311.         SkipPattern := False;
  312.         Exit;
  313.       end
  314.     end else
  315.     if ((Pattern [I] = 'X') and (Upcase [Str [Pos + I - 1]] in ['L', 'H']))
  316.     or ((Pattern [I] in ['L', 'H']) and (Upcase [Str [Pos + I - 1]] = 'X'))
  317.     then
  318.       {Ok}
  319.     else
  320.     if Pattern [I] = 'H' then begin
  321.       if Upcase [Str [Pos + I - 1]] <> 'H' then begin
  322.         Delete (Pattern, I, 1);
  323.         Dec (I);
  324.       end;
  325.     end else
  326.     if Upcase [Str [Pos + I - 1]] <> Upcase [Pattern [I]] then begin
  327.       SkipPattern := False;
  328.       Exit;
  329.     end;
  330.  
  331.     Inc (I);
  332.   end;
  333.  
  334.   if Pos + Length (Pattern) - 1 <= Length (Str) then begin
  335.     if  (Pos + Length (Pattern) <= Length (Str))
  336.     and (Str [Pos + Length (Pattern)] in (['/', 'h', 'H', ':', '-'] + HexChars))
  337.     and (Pos + Length (Pattern) + 1 <= Length (Str))
  338.     and (not (Str [Pos + Length (Pattern) + 1] in ['I', 'R', 'W', '-', ' ']))
  339.     then begin
  340.       WriteLn (IncompPattern, Str);
  341.       WriteLn (IncompPattern, 'not a complete pattern ', Pattern);
  342.     end;
  343.  
  344.     Inc (Pos, Length (Pattern) - 1);
  345.  
  346.     SkipPattern := True;
  347.   end else
  348.     SkipPattern := False;
  349. end;
  350.  
  351. procedure AddStr2Topic (Str: string; var Topic: PTopic;
  352.                         var TopicName: string; const CurInt, CurSubF, CurCat: string;
  353.                         Indexed: Boolean);
  354. var I: Integer;
  355.     KeyCnt: Integer;
  356.     OldTopicName: string;
  357.     OldTopicCount: Word;
  358. begin
  359.   KeyCnt := 0;
  360.   for I := 1 to Length (Str) do
  361.     if Str [I] = #2 then
  362.       Inc (KeyCnt);
  363.  
  364.   I := 1;
  365.   while I <= Length (Str) do begin
  366.     if Str [I] = #2 then
  367.       Dec (KeyCnt);
  368.  
  369.     if not Odd (KeyCnt) then
  370.       if  (I + 4 <= Length (Str))
  371.       and (Str [I] = '#')
  372.       and (Str [I + 1] in ['0'..'9', 'C', 'F', 'M', 'R', 'P'])
  373.       and (Str [I + 2] in ['0'..'9'])
  374.       and (Str [I + 3] in ['0'..'9'])
  375.       and (Str [I + 4] in ['0'..'9'])
  376.       then begin
  377.         Topic^. AddKeyword (Copy (Str, I, 5), KeyCnt div 2);
  378.         Insert (#2, Str, I + 5);
  379.         Insert (#2, Str, I);
  380.         Inc (I, 6);
  381.       end else
  382.         if (I = 1)
  383.         or (not (Upcase [Str [I - 1]] in ['A'..'Z', '0'..'9'])) then
  384.           case Upcase [Str [I]] of
  385.           'I':
  386.             if ProcessPattern (Str, I, 'INT '#3#3'H/AX='#3#3#3#3'H/'#4#4'='#3#3#3#3'H',
  387.                  #3#3#3#3#3#3#4#4#3#3#3#3 + CurCat, Topic, KeyCnt div 2)
  388.  
  389.             or ProcessPattern (Str, I, 'INT 13/AX=2000H/DL=81H', '1320' + CurCat, Topic, KeyCnt div 2)
  390.             or ProcessPattern (Str, I, 'INT '#3#3'H/AX='#3#3#3#3'H/'#5#5'='#3#3'H',
  391.                  #3#3#3#3#3#3#5#5#3#3 + CurCat, Topic, KeyCnt div 2)
  392.  
  393.             or ProcessPattern (Str, I, 'INT 21/AX=4202H/CX=0/DX=0', '2142' + CurCat, Topic, KeyCnt div 2)
  394.             or ProcessPattern (Str, I, 'INT '#3#3'H/AX='#6#6#6#6'H-'#6#6#6#6'H',
  395.                  'INT '#3#3, Topic, KeyCnt div 2)
  396.             or ProcessPattern (Str, I, 'INT '#3#3'H/AX='#3#3#3#3'H',
  397.                  #3#3#3#3#3#3 + CurCat, Topic, KeyCnt div 2)
  398.  
  399.             or ProcessPattern (Str, I, 'INT '#3#3'H/AH='#3#3#3#3'H',
  400.                  #3#3#3#3#3#3 + CurCat, Topic, KeyCnt div 2)
  401.  
  402.             or ProcessPattern (Str, I, 'INT '#3#3'H/AH='#3#3'H/'#4#4'='#3#3#3#3'H',
  403.                  #3#3#3#3'--'#4#4#3#3#3#3 + CurCat, Topic, KeyCnt div 2)
  404.             or ProcessPattern (Str, I, 'INT '#3#3'H/AH='#3#3'H/'#5#5'='#3#3'H',
  405.                  #3#3#3#3'--'#5#5#3#3 + CurCat, Topic, KeyCnt div 2)
  406.             or ProcessPattern (Str, I, 'INT '#3#3'H/AH='#6#6'H-'#6#6'H',
  407.                  'INT '#3#3, Topic, KeyCnt div 2)
  408.             or ProcessPattern (Str, I, 'INT '#3#3'H/AH='#3#3'H',
  409.                  #3#3#3#3 + CurCat, Topic, KeyCnt div 2)
  410.  
  411.             or ProcessPattern (Str, I, 'INT '#3#3'H/AL='#3#3'H/'#4#4'='#3#3#3#3'H',
  412.                  #3#3'--'#3#3#4#4#3#3#3#3 + CurCat, Topic, KeyCnt div 2)
  413.             or ProcessPattern (Str, I, 'INT '#3#3'H/AL='#3#3'H/'#5#5'='#3#3'H',
  414.                  #3#3'--'#3#3#5#5#3#3 + CurCat, Topic, KeyCnt div 2)
  415.             or ProcessPattern (Str, I, 'INT '#3#3'H/AL='#3#3'H',
  416.                  #3#3'--'#3#3 + CurCat, Topic, KeyCnt div 2)
  417.  
  418.             or ProcessPattern (Str, I, 'INT '#3#3'H/'#4#4'='#3#3#3#3'H',
  419.                  #3#3'----'#4#4#3#3#3#3 + CurCat, Topic, KeyCnt div 2)
  420.             or ProcessPattern (Str, I, 'INT '#3#3'H/'#5#5'='#3#3'H',
  421.                  #3#3'----'#5#5#3#3 + CurCat, Topic, KeyCnt div 2)
  422.  
  423.             or ProcessPattern (Str, I, 'INT '#3#3'H/'#3#3#3#3'H',
  424.                  #3#3#3#3#3#3 + CurCat, Topic, KeyCnt div 2)
  425.             or ProcessPattern (Str, I, 'INT '#3#3'H/'#6#6'H-'#6#6'H',
  426.                  'INT '#3#3, Topic, KeyCnt div 2)
  427.             or ProcessPattern (Str, I, 'INT '#3#3'H/'#3#3'H',
  428.                  #3#3#3#3 + CurCat, Topic, KeyCnt div 2)
  429.             or ProcessPattern (Str, I, 'INT '#6#6'-INT '#6#6'H',
  430.                  'TITLES', Topic, KeyCnt div 2)
  431.             or ProcessPattern (Str, I, 'INT '#6#6'-'#6#6'H',
  432.                  'TITLES', Topic, KeyCnt div 2)
  433.             or ProcessPattern (Str, I, 'INT XXH',
  434.                  'TITLES', Topic, KeyCnt div 2)
  435.             or ProcessPattern (Str, I, 'INT '#3#3'H',
  436.                  'INT '#3#3, Topic, KeyCnt div 2)
  437.             then
  438.               ;
  439.           'A':
  440.             if ProcessPattern (Str, I, 'AX='#3#3#3#3'H/'#4#4'='#3#3#3#3'H',
  441.                  CurInt + #3#3#3#3#4#4#3#3#3#3 + CurCat, Topic, KeyCnt div 2)
  442.             or ProcessPattern (Str, I, 'AX='#3#3#3#3'H/'#5#5'='#3#3'H',
  443.                  CurInt + #3#3#3#3#5#5#3#3 + CurCat, Topic, KeyCnt div 2)
  444.             or ProcessPattern (Str, I, 'AX='#6#6#6#6'H-'#6#6#6#6'H',
  445.                  'INT ' + CurInt, Topic, KeyCnt div 2)
  446.             or ProcessPattern (Str, I, 'AX='#3#3#3#3'H',
  447.                  CurInt + #3#3#3#3 + CurCat, Topic, KeyCnt div 2)
  448.             or ProcessPattern (Str, I, 'AH='#3#3'H/AL='#3#3'H',
  449.                  CurInt + #3#3#3#3 + CurCat, Topic, KeyCnt div 2)
  450.  
  451.             or ProcessPattern (Str, I, 'AH='#3#3'H/'#4#4'='#3#3#3#3'H',
  452.                  CurInt + #3#3'--'#4#4#3#3#3#3 + CurCat, Topic, KeyCnt div 2)
  453.             or ProcessPattern (Str, I, 'AH='#3#3'H/'#5#5'='#3#3'H',
  454.                  CurInt + #3#3'--'#5#5#3#3 + CurCat, Topic, KeyCnt div 2)
  455.             or ProcessPattern (Str, I, 'AH='#6#6'H-'#6#6'H',
  456.                  'INT ' + CurInt, Topic, KeyCnt div 2)
  457.             or ProcessPattern (Str, I, 'AH='#3#3'H',
  458.                  CurInt + #3#3 + CurCat, Topic, KeyCnt div 2)
  459.  
  460.             or ProcessPattern (Str, I, 'AL='#3#3'H/'#4#4'='#3#3#3#3'H',
  461.                  CurInt + Copy (CurSubF, 1, 2) + #3#3#4#4#3#3#3#3 + CurCat, Topic, KeyCnt div 2)
  462.             or ProcessPattern (Str, I, 'AL='#3#3'H/'#5#5'='#3#3'H',
  463.                  CurInt + Copy (CurSubF, 1, 2) + #3#3#5#5#3#3 + CurCat, Topic, KeyCnt div 2)
  464.             or ProcessPattern (Str, I, 'AL='#6#6'H/'#6#6'H',
  465.                  CurInt + Copy (CurSubF, 1, 2) + CurCat, Topic, KeyCnt div 2)
  466.             or ProcessPattern (Str, I, 'AL='#6#6'H-'#6#6'H',
  467.                  CurInt + Copy (CurSubF, 1, 2) + CurCat, Topic, KeyCnt div 2)
  468.             or ProcessPattern (Str, I, 'AL='#3#3'H',
  469.                  CurInt + Copy (CurSubF, 1, 2) + #3#3 + CurCat, Topic, KeyCnt div 2)
  470.             then
  471.               ;
  472.           'B', 'C', 'D', 'S', 'E', 'F', 'G', 'V':
  473.             if ProcessPattern (Str, I, #4#4'='#3#3#3#3'H',
  474.                  CurInt + CurSubF + #4#4#3#3#3#3 + CurCat, Topic, KeyCnt div 2)
  475.             or SkipPattern (Str, I, 'CX=CX-1')
  476.             or ProcessPattern (Str, I, #8#8'='#6#6'H/'#6#6'H',
  477.                  CurInt + CurSubF + CurCat, Topic, KeyCnt div 2)
  478.             or ProcessPattern (Str, I, #8#8'='#6#6'H-'#6#6'H',
  479.                  CurInt + CurSubF + CurCat, Topic, KeyCnt div 2)
  480.             or ProcessPattern (Str, I, #5#5'='#3#3'H',
  481.                  CurInt + CurSubF + #5#5#3#3 + CurCat, Topic, KeyCnt div 2)
  482.             then
  483.               {nothing}
  484.             else
  485.             if Upcase [Str [I]] = 'C' then begin
  486.               if ProcessPattern (Str, I, 'CMOS DATA',
  487.                    'CMOS', Topic, KeyCnt div 2)
  488.               or ProcessPattern (Str, I, 'CMOS 8086/88',
  489.                    'CMOS', Topic, KeyCnt div 2)
  490.               or ProcessPattern (Str, I, 'CMOS 80C86/88',
  491.                    'CMOS', Topic, KeyCnt div 2)
  492.               or ProcessPattern (Str, I, 'CMOS '#3#3#3#3'H',
  493.                    'R'#3#3#3#3 + CurCat, Topic, KeyCnt div 2)
  494.               or ProcessPattern (Str, I, 'CMOS '#3#3'H-'#3#3'H',
  495.                    'R'#3#3#3#3 + CurCat, Topic, KeyCnt div 2)
  496.               or ProcessPattern (Str, I, 'CMOS '#3#3'H',
  497.                    'R'#3#3 + CurCat, Topic, KeyCnt div 2)
  498.               or ProcessPattern (Str, I, 'CMOS',
  499.                    'CMOS', Topic, KeyCnt div 2)
  500.  
  501.               or ProcessPattern (Str, I, 'CALL XXXXH:XXXXH"',
  502.                    '@xxxxxxxx', Topic, KeyCnt div 2)
  503.               or ProcessPattern (Str, I, 'CALL XXXXH:XXXXH',
  504.                    'FAR CALLS', Topic, KeyCnt div 2)
  505.               or ProcessPattern (Str, I, 'CALL '#3#3#3#3'H:'#3#3#3#3'H',
  506.                  '@'#3#3#3#3#3#3#3#3 + CurCat, Topic, KeyCnt div 2)
  507.               then
  508.                 ;
  509.             end;
  510.           '@':
  511.             if ProcessPattern (Str, I, '@XXXXH:XXXXH"',
  512.                  '@xxxxxxxx', Topic, KeyCnt div 2)
  513.             or ProcessPattern (Str, I, '@XXXXH:XXXXH',
  514.                  'FAR CALLS', Topic, KeyCnt div 2)
  515.             or ProcessPattern (Str, I, '@'#3#3#3#3'H:'#3#3#3#3'H',
  516.                  '@'#3#3#3#3#3#3#3#3 + CurCat, Topic, KeyCnt div 2)
  517.             then
  518.               ;
  519.           'M':
  520.             if ProcessPattern (Str, I, 'MEM '#6#6#6#6'H:xxxxH',
  521.                  'MEMORY', Topic, KeyCnt div 2)
  522.             or ProcessPattern (Str, I, 'MEM '#3#3#3#3'H:'#3#3#3#3'H',
  523.                  'M'#3#3#3#3#3#3#3#3 + CurCat, Topic, KeyCnt div 2)
  524.             or ProcessPattern (Str, I, 'MEM '#3#3#3#3#3#3#3#3'H',
  525.                  'M'#3#3#3#3#3#3#3#3 + CurCat, Topic, KeyCnt div 2)
  526.  
  527.             or ProcessPattern (Str, I, 'MSR '#3#3#3#3#3#3#3#3'H',
  528.                  'S'#3#3#3#3#3#3#3#3 + CurCat, Topic, KeyCnt div 2)
  529.             then
  530.               ;
  531.           'P':
  532.             if ProcessPattern (Str, I, 'PORT ACCESS',
  533.                  'PORTS', Topic, KeyCnt div 2)
  534.             or ProcessPattern (Str, I, 'PORT '#3#3#3#3'H-'#3#3#3#3'H',
  535.                  'P'#3#3#3#3#3#3#3#3 + CurCat, Topic, KeyCnt div 2)
  536.             or ProcessPattern (Str, I, 'PORT '#3#3#3#3'H-'#3#3#3'H',
  537.                  'P'#3#3#3#3#3#3#3' ' + CurCat, Topic, KeyCnt div 2)
  538.             or ProcessPattern (Str, I, 'PORT '#3#3#3#3'H-????H',
  539.                  'P'#3#3#3#3'????' + CurCat, Topic, KeyCnt div 2)
  540.             or ProcessPattern (Str, I, 'PORT '#3#3#3#3'H',
  541.                  'P'#3#3#3#3 + CurCat, Topic, KeyCnt div 2)
  542.             then
  543.               ;
  544.           end;
  545.  
  546.     Inc (I);
  547.   end;
  548.  
  549.   Topic^. AddString (' ' + Str);
  550.  
  551.   if Topic^. Size > (65536 * 2) div 3 then begin
  552.     WriteLn ('topic ', TopicName, ' will be splited, index mode - ', Indexed);
  553.  
  554.     OldTopicName := TopicName;
  555.     OldTopicCount := Topic^.Count;
  556.  
  557.     TopicName := TopicName + '_';
  558.     TopicName := MakeCorrectTopicName (TopicName);
  559.  
  560.     Topic^. AddKeyword (TopicName, 0);
  561.     Topic^. AddString (' '#2'next page'#2);
  562.  
  563.     FO. IdxTbl. Insert (New (PIndexEntry, Init (
  564.       OldTopicName, '', 0, Topic, Indexed)));
  565.  
  566.     New (Topic, Init (1, 1));
  567.  
  568.     Topic^. AddKeyword (OldTopicName, 0);
  569.     Topic^. AddString (' '#2'previous page'#2);
  570.   end;
  571. end;
  572.  
  573. function ProcessInterrup (const FileName: string; const FileIsATopic: string): Boolean;
  574. type
  575.   DividerRec = record
  576.     Len: Byte;
  577.     S: array [0..7] of Char;   (* '--------' *)
  578.     Cat: Char;                 (* category *)
  579.     C: Char;                   (* '-' *)
  580.     case Integer of
  581.       0: (Int: array [0..1] of Char; (* Interrupt number, 2 hex digits *)
  582.           SubF: array [0..3] of Char;(* sub function, 4 hex digits or '-' *)
  583.           R: array [0..1] of Char;   (* Secondary Register Name, Two Letters or '--' *)
  584.           RV: array [0..3] of Char;  (* sec. reg. value, 4 hex digits or '-' *)
  585.           Rest: array [0..17] of Char;
  586.          );
  587.       1: (RSign: Char;
  588.           R1,
  589.           R2: array [0..1] of Char;
  590.          );
  591.       2: (AtSign: Char;
  592.           CallSeg,
  593.           CallOfs: array [0..3] of Char;
  594.          );
  595.       3: (MSign: Char;
  596.           MemSeg,
  597.           MemOfs: array [0..3] of Char;
  598.          );
  599.       4: (SSign: Char;
  600.           MSR: array [0..7] of Char;
  601.          );
  602.       5: (PSign: Char;
  603.           P1,
  604.           P2: array [0..3] of Char;
  605.          );
  606.       6: (Cat2: Char;                (* category *)
  607.           C2: Char;                  (* '-' *)
  608.          );
  609.   end;            (* record dividerRec *)
  610.  
  611.   T2W = record Lo, Hi: Word; end;
  612.   T22 = record Lo, Hi: array [0..1] of Char; end;
  613.  
  614. var
  615.   FI: Text;
  616.   Str, StrUp: string;
  617.   TopicName: string;
  618.  
  619.   CurCat: string [1];
  620.   CurInt: string [2];
  621.   CurSubF: string [4];
  622.  
  623.   DR: DividerRec absolute Str;
  624.  
  625. procedure ProcessHdr (Hdr: string);
  626. begin
  627.   with DR do begin
  628.     if (S <> '--------')
  629.     or (not (Cat in ['A'..'Z', 'a'..'z', '!', '*', '-']))
  630.     or (C <> '-')
  631.     or ((Cat <> '!')
  632.         and
  633.         ((Cat <> '-')
  634.       or (C2 <> '-')
  635.       or (Pos ('OPCODES', StUpcase2 (FileName)) = 0)
  636.         )
  637.         and
  638.         ((not (RSign in ['R', 'r']))
  639.       or (not (R1 [0] in HexChars))
  640.       or (not (R1 [1] in HexChars))
  641.       or (  (R2 <> '--')
  642.         and ((not (R2 [0] in HexChars))
  643.           or (not (R2 [1] in HexChars)))
  644.          )
  645.         )
  646.         and
  647.         ((not (AtSign = '@'))
  648.       or (not (CallSeg [0] in HexChars + ['x']))
  649.       or (not (CallSeg [1] in HexChars + ['x']))
  650.       or (not (CallSeg [2] in HexChars + ['x']))
  651.       or (not (CallSeg [3] in HexChars + ['x']))
  652.       or (not (CallOfs [0] in HexChars + ['x']))
  653.       or (not (CallOfs [1] in HexChars + ['x']))
  654.       or (not (CallOfs [2] in HexChars + ['x']))
  655.       or (not (CallOfs [3] in HexChars + ['x']))
  656.         )
  657.         and
  658.         ((not (MSign in ['M', 'm']))
  659.       or (not (MemSeg [0] in HexChars + ['x']))
  660.       or (not (MemSeg [1] in HexChars + ['x']))
  661.       or (not (MemSeg [2] in HexChars + ['x']))
  662.       or (not (MemSeg [3] in HexChars + ['x']))
  663.       or (not (MemOfs [0] in HexChars + ['x']))
  664.       or (not (MemOfs [1] in HexChars + ['x']))
  665.       or (not (MemOfs [2] in HexChars + ['x']))
  666.       or (not (MemOfs [3] in HexChars + ['x']))
  667.         )
  668.         and
  669.         ((not (SSign in ['S', 's']))
  670.       or (not (MSR [0] in HexChars))
  671.       or (not (MSR [1] in HexChars))
  672.       or (not (MSR [2] in HexChars))
  673.       or (not (MSR [3] in HexChars))
  674.       or (not (MSR [4] in HexChars))
  675.       or (not (MSR [5] in HexChars))
  676.       or (not (MSR [6] in HexChars))
  677.       or (not (MSR [7] in HexChars))
  678.         )
  679.         and
  680.         ((not (PSign in ['P', 'p']))
  681.       or (not (P1 [0] in HexChars + ['x']))
  682.       or (not (P1 [1] in HexChars + ['x']))
  683.       or (not (P1 [2] in HexChars + ['x']))
  684.       or (not (P1 [3] in HexChars + ['x']))
  685.       or (  (P2 <> '----')
  686.         and (P2 <> '????')
  687.         and ((not (P2 [0] in HexChars))
  688.           or (not (P2 [1] in HexChars))
  689.           or (not (P2 [2] in HexChars))
  690.           or (not (P2 [3] in HexChars + ['x', ' '])))
  691.          )
  692.         )
  693.         and
  694.         ((not (Int [0] in HexChars))
  695.       or (not (Int [1] in HexChars))
  696.       or (  (SubF <> '----')
  697.         and ((T22 (SubF). Lo <> '--')
  698.           or (not (SubF [2] in HexChars))
  699.           or (not (SubF [3] in HexChars)))
  700.         and ((T22 (SubF). Hi <> '--')
  701.           or (not (SubF [0] in HexChars))
  702.           or (not (SubF [1] in HexChars)))
  703.         and ((not (SubF [0] in HexChars))
  704.           or (not (SubF [1] in HexChars))
  705.           or (not (SubF [2] in HexChars))
  706.           or (not (SubF [3] in HexChars)))
  707.          )
  708.       or (  (R <> '--')
  709.         and ((R <> 'BX') or (not (RV [0] in HexChars))
  710.                          or (not (RV [1] in HexChars))
  711.                          or (not (RV [2] in HexChars))
  712.                          or (not (RV [3] in HexChars)))
  713.         and ((R <> 'CX') or (not (RV [0] in HexChars))
  714.                          or (not (RV [1] in HexChars))
  715.                          or (not (RV [2] in HexChars))
  716.                          or (not (RV [3] in HexChars)))
  717.         and ((R <> 'DX') or (not (RV [0] in HexChars))
  718.                          or (not (RV [1] in HexChars))
  719.                          or (not (RV [2] in HexChars))
  720.                          or (not (RV [3] in HexChars)))
  721.         and ((R <> 'SI') or (not (RV [0] in HexChars))
  722.                          or (not (RV [1] in HexChars))
  723.                          or (not (RV [2] in HexChars))
  724.                          or (not (RV [3] in HexChars)))
  725.         and ((R <> 'DI') or (not (RV [0] in HexChars))
  726.                          or (not (RV [1] in HexChars))
  727.                          or (not (RV [2] in HexChars))
  728.                          or (not (RV [3] in HexChars)))
  729.         and ((R <> 'SP') or (not (RV [0] in HexChars))
  730.                          or (not (RV [1] in HexChars))
  731.                          or (not (RV [2] in HexChars))
  732.                          or (not (RV [3] in HexChars)))
  733.         and ((R <> 'BP') or (not (RV [0] in HexChars))
  734.                          or (not (RV [1] in HexChars))
  735.                          or (not (RV [2] in HexChars))
  736.                          or (not (RV [3] in HexChars)))
  737.         and ((R <> 'ES') or (not (RV [0] in HexChars))
  738.                          or (not (RV [1] in HexChars))
  739.                          or (not (RV [2] in HexChars))
  740.                          or (not (RV [3] in HexChars)))
  741.         and ((R <> 'DS') or (not (RV [0] in HexChars))
  742.                          or (not (RV [1] in HexChars))
  743.                          or (not (RV [2] in HexChars))
  744.                          or (not (RV [3] in HexChars)))
  745.  
  746.         and ((R <> 'BH') or (not (RV [0] in HexChars))
  747.                          or (not (RV [1] in HexChars))
  748.                          or (T22 (RV). Hi <> '--'))
  749.         and ((R <> 'BL') or (not (RV [0] in HexChars))
  750.                          or (not (RV [1] in HexChars))
  751.                          or (T22 (RV). Hi <> '--'))
  752.         and ((R <> 'CH') or (not (RV [0] in HexChars))
  753.                          or (not (RV [1] in HexChars))
  754.                          or (T22 (RV). Hi <> '--'))
  755.         and ((R <> 'CL') or (not (RV [0] in HexChars))
  756.                          or (not (RV [1] in HexChars))
  757.                          or (T22 (RV). Hi <> '--'))
  758.         and ((R <> 'DH') or (not (RV [0] in HexChars))
  759.                          or (not (RV [1] in HexChars))
  760.                          or (T22 (RV). Hi <> '--'))
  761.         and ((R <> 'DL') or (not (RV [0] in HexChars))
  762.                          or (not (RV [1] in HexChars))
  763.                          or (T22 (RV). Hi <> '--'))
  764.  
  765.         and ((R <> 'SF') or (not (RV [0] in HexChars))
  766.                          or (not (RV [1] in HexChars))
  767.                          or (not (RV [2] in HexChars))
  768.                          or (not (RV [3] in HexChars)))
  769.         and ((R <> 'SF') or (not (RV [0] in HexChars))
  770.                          or (not (RV [1] in HexChars))
  771.                          or (T22 (RV). Hi <> '--'))
  772.  
  773.         and ((R <> 'Vx') or (not (RV [0] in HexChars))
  774.                          or (not (RV [1] in HexChars))
  775.                          or (not (RV [2] in HexChars))
  776.                          or (not (RV [3] in HexChars)))
  777.          )
  778.       or (Rest <> '------------------')
  779.         )
  780.         and
  781.         (Hdr <> '-----------------------------------------')
  782.         and
  783.         (Hdr <> '------------------------------------------')
  784.         and
  785.         (Hdr <> '--------------------------------------------')
  786.         and
  787.         (Hdr <> '---------------------------------------------')
  788.         and
  789.         (Hdr <> '----------------------------------------------')
  790.         and
  791.         (Hdr <> '------------------------------------------------')
  792.         and
  793.         (Hdr <> '-------------------------------------------------')
  794.         and
  795.         (Hdr <> '--------------------------------------------------')
  796.         and
  797.         (Hdr <> '---------------------------------------------------')
  798.         and
  799.         (Hdr <> '----------------------------------------------------')
  800.         and
  801.         (Hdr <> '-----------------------------------------------------')
  802.         and
  803.         (Hdr <> '------------------------------------------------------')
  804.         and
  805.         (Hdr <> '---------------------------------------------------------')
  806.         and
  807.         (Hdr <> '----------------------------------------------------------')
  808.         and
  809.         (Hdr <> '-----------------------------------------------------------')
  810.         and
  811.         (Hdr <> '------------------------------------------------------------')
  812.         and
  813.         (Hdr <> '-------------------------------------------------------------')
  814.         and
  815.         (Hdr <> '--------------------------------------------------------------')
  816.        )
  817.     then
  818.       WriteLn (' ': 79, #13, 'header error: ', Hdr);
  819.  
  820.     if Cat = '!' then begin
  821.       TopicName := Copy (Str, 10, Length (Str) - 9);
  822.       CurInt := '';
  823.       CurSubF := '';
  824.     end else
  825.     if  (Cat = '-') and (C2 = '-')
  826.     and (Pos ('OPCODES', StUpcase2 (FileName)) > 0) then begin
  827.       TopicName := Copy (Str, 12, Length (Str) - 11);
  828.       CurInt := '';
  829.       CurSubF := '';
  830.     end else
  831.       if RSign in ['R', 'r'] then begin
  832.         TopicName := RSign + R1 + R2;
  833.         CurInt := '';
  834.         CurSubF := '';
  835.       end else
  836.       if AtSign = '@' then begin
  837.         TopicName := AtSign + CallSeg + CallOfs;
  838.         CurInt := '';
  839.         CurSubF := '';
  840.       end else
  841.       if MSign in ['M', 'm'] then begin
  842.         TopicName := MSign + MemSeg + MemOfs;
  843.         CurInt := '';
  844.         CurSubF := '';
  845.       end else
  846.       if SSign in ['S', 's'] then begin
  847.         TopicName := SSign + MSR;
  848.         CurInt := '';
  849.         CurSubF := '';
  850.       end else
  851.       if PSign in ['P', 'p'] then begin
  852.         TopicName := PSign + P1 + P2;
  853.         CurInt := '';
  854.         CurSubF := '';
  855.       end else begin
  856.         TopicName := Int + SubF + R + RV;
  857.         CurInt := Int;
  858.         CurSubF := SubF;
  859.       end;
  860.  
  861.     while TopicName [Length (TopicName)] in ['-', ' ', #9] do Dec (TopicName [0]);
  862.     if Length (TopicName) > 0 then
  863.       while TopicName [1] in ['-', ' ', #9] do Delete (TopicName, 1, 1)
  864.     else
  865.       TopicName := FileName;
  866.  
  867.     if not (Cat in ['!', '-']) then begin
  868.       TopicName := TopicName + Cat;
  869.       CurCat := Cat;
  870.     end else
  871.       CurCat := '';
  872.   end;
  873. end;
  874.  
  875. var
  876.   SectionStarted: Boolean;
  877.   SectionClosed: Boolean;
  878.   I, J: Integer;
  879.   Topic: PTopic;
  880.   ExtendedHeader: string;
  881.   OriginalTopicName: string;
  882.  
  883.   TblStarted: Boolean;
  884.   TblClosed: Boolean;
  885.   TblTopic: PTopic;
  886.   TblTopicName: string;
  887.  
  888.   PrevStr, SavePtr: PString;
  889.   AddNextStringToTopicAsATblRef: Boolean;
  890.  
  891.   IndexThisTopic: Boolean;
  892.  
  893. begin
  894.   Assign (FI, FileName);
  895.   {$I-}
  896.   Reset (FI);
  897.   if IOResult = 0 then begin
  898.     ProcessInterrup := True;
  899.     WriteLn ('processing ', FileName, '                                      ');
  900.  
  901.     TblStarted := False;
  902.     TblClosed := True;
  903.  
  904.     SectionStarted := False;
  905.     SectionClosed := True;
  906.  
  907.     AddNextStringToTopicAsATblRef := False;
  908.  
  909.     IndexThisTopic := True;
  910.  
  911.     if FileIsATopic <> '' then begin
  912.       TopicName := FileIsATopic;
  913.       CurCat := '';
  914.       CurInt := '';
  915.       CurSubF := '';
  916.  
  917.       New (Topic, Init (1, 1));
  918.       SectionStarted := True;
  919.       SectionClosed := False;
  920.       TopicName := MakeCorrectTopicName (TopicName);
  921.       OriginalTopicName := TopicName;
  922.       ExtendedHeader := #2 + TopicName + #2;
  923.     end;
  924.  
  925.     while not EOF (FI) do begin
  926.       ReadLn (FI, Str);
  927.  
  928.       if  (Length (Str) > 0)
  929.       and (FileIsATopic = '')
  930.       and ((Str [1] = '-') and (Pos ('--------', Str) <> 0))
  931.       and (Str <> '--------------')
  932.       then begin
  933.         if not TblClosed then begin
  934.           TblTopic^.AddKeyword (OriginalTopicName, 0);
  935.           AddStr2Topic (ExtendedHeader, TblTopic, TblTopicName, CurInt, CurSubF, CurCat, False);
  936.           FO. IdxTbl. Insert (New (PIndexEntry, Init (
  937.             TblTopicName, '', 0, TblTopic, False)));
  938.           TblStarted := False;
  939.           TblClosed := True;
  940.         end;
  941.  
  942.         if not SectionClosed then begin
  943.           if Pos ('CMOS', StUpcase2 (FileName)) > 0 then begin
  944.             CMOS^.AddKeyword (OriginalTopicName, 0);
  945.             AddStr2Topic (ExtendedHeader,
  946.                           CMOS, CMOSName, CurInt, CurSubF, CurCat, True);
  947.           end else
  948.           if Pos ('FARCALL', StUpcase2 (FileName)) > 0 then begin
  949.             FarCall^.AddKeyword (OriginalTopicName, 0);
  950.             AddStr2Topic (ExtendedHeader,
  951.                           FarCall, FarCallName, CurInt, CurSubF, CurCat, True);
  952.           end else
  953.           if Pos ('MEMORY', StUpcase2 (FileName)) > 0 then begin
  954.             Memory^.AddKeyword (OriginalTopicName, 0);
  955.             AddStr2Topic (ExtendedHeader,
  956.                           Memory, MemoryName, CurInt, CurSubF, CurCat, True);
  957.           end else
  958.           if Pos ('MSR', StUpcase2 (FileName)) > 0 then begin
  959.             MSR^.AddKeyword (OriginalTopicName, 0);
  960.             AddStr2Topic (ExtendedHeader,
  961.                           MSR, MSRName, CurInt, CurSubF, CurCat, True);
  962.           end else
  963.           if Pos ('OPCODES', StUpcase2 (FileName)) > 0 then begin
  964.             OpCodes^.AddKeyword (OriginalTopicName, 0);
  965.             AddStr2Topic (ExtendedHeader,
  966.                           OpCodes, OpCodesName, CurInt, CurSubF, CurCat, True);
  967.           end else
  968.           if Pos ('PORTS', StUpcase2 (FileName)) > 0 then begin
  969.             Ports^.AddKeyword (OriginalTopicName, 0);
  970.             AddStr2Topic (ExtendedHeader,
  971.                           Ports, PortsName, CurInt, CurSubF, CurCat, True);
  972.           end else
  973.           if  (FileIsATopic = '')
  974.           and ((not (ExtendedHeader [2] in HexChars))
  975.             or (not (ExtendedHeader [3] in HexChars)))
  976.           then begin
  977.             IntList^.AddKeyword (OriginalTopicName, 0);
  978.             AddStr2Topic (ExtendedHeader,
  979.                           IntList, IntListName, CurInt, CurSubF, CurCat, True);
  980.           end;
  981.  
  982.           FO. IdxTbl. Insert (New (PIndexEntry, Init (
  983.             TopicName, '', 0, Topic, IndexThisTopic)));
  984.           IndexThisTopic := True;
  985.           SectionClosed := True;
  986.         end;
  987.  
  988.         ProcessHdr (Str);
  989.  
  990.         if (StUpcase2 (TopicName) <> 'SECTION') then begin
  991.           New (Topic, Init (1, 1));
  992.           SectionStarted := True;
  993.           SectionClosed := False;
  994.           TopicName := MakeCorrectTopicName (TopicName);
  995.           OriginalTopicName := TopicName;
  996.           ExtendedHeader := #2 + TopicName + #2;
  997.           Write (TopicName: 31, ' mem - ', MaxAvail: 8, #13);
  998.         end else
  999.           SectionStarted := False;
  1000.       end else begin
  1001.         if SectionStarted then begin
  1002.           I := Pos (#9, Str);
  1003.           while I > 0 do begin
  1004.             Delete (Str, I, 1);
  1005.             for J := 7 downto ((I - 1) mod 8) do
  1006.               Insert (' ', Str, I);
  1007.             I := Pos (#9, Str);
  1008.           end;
  1009.  
  1010.           StrUp := StUpcase2 (Str);
  1011.  
  1012.           if  (Copy (StrUp, 1, 4) = 'INT ')
  1013.           and (StrUp [5] in HexChars) and (StrUp [6] in HexChars)
  1014.           and (Pos ('INT', StUpcase2 (FileName)) > 0) then begin
  1015.             I := (Pos (StrUp [5], HexCh) - 1)*16 + Pos (StrUp [6], HexCh) - 1;
  1016.             IntLists [I]^.AddKeyword (OriginalTopicName, 0);
  1017.             ExtendedHeader := #2 + TopicName + #2
  1018.                             + Copy (Str, 7, Length (Str) - 6);
  1019.             AddStr2Topic (ExtendedHeader,
  1020.                           IntLists [I], string (Pointer(@IntNames [I])^), CurInt, CurSubF, CurCat, True);
  1021.             if not ExtendedIndex then
  1022.               IndexThisTopic := False; {'cause this topic is indexed in INT XX}
  1023.           end;
  1024.  
  1025.           if  (Copy (StrUp, 1, 5) = 'CMOS ')
  1026.           and (StrUp [6] in HexChars) and (StrUp [7] in HexChars)
  1027.           and (StrUp [8] = 'H') then begin
  1028.             if  (StrUp [9] = '-')
  1029.             and (StrUp [10] in HexChars) and (StrUp [11] in HexChars)
  1030.             and (StrUp [12] = 'H') then
  1031.               ExtendedHeader := Copy (Str, 13, Length (Str) - 12)
  1032.             else
  1033.               ExtendedHeader := Copy (Str, 9, Length (Str) - 8);
  1034.  
  1035.             ExtendedHeader := #2 + TopicName + #2 + ExtendedHeader;
  1036.           end;
  1037.  
  1038.           if  (Copy (StrUp, 1, 5) = 'CALL ')
  1039.           and (StrUp [6] in HexChars + ['X']) and (StrUp [7] in HexChars + ['X'])
  1040.           and (StrUp [8] in HexChars + ['X']) and (StrUp [9] in HexChars + ['X'])
  1041.           and (StrUp [10] = 'H')
  1042.           and (StrUp [11] = ':')
  1043.           and (StrUp [12] in HexChars + ['X']) and (StrUp [13] in HexChars + ['X'])
  1044.           and (StrUp [14] in HexChars + ['X']) and (StrUp [15] in HexChars + ['X'])
  1045.           and (StrUp [16] = 'H')
  1046.           then begin
  1047.             ExtendedHeader := #2 + TopicName + #2
  1048.                             + Copy (Str, 17, Length (Str) - 16);
  1049.           end;
  1050.  
  1051.           if  (Copy (StrUp, 1, 4) = 'MEM ')
  1052.           and (StrUp [5] in HexChars + ['X']) and (StrUp [6] in HexChars + ['X'])
  1053.           and (StrUp [7] in HexChars + ['X']) and (StrUp [8] in HexChars + ['X'])
  1054.           then
  1055.             if  (StrUp [9] = 'H')
  1056.             and (StrUp [10] = ':')
  1057.             and (StrUp [11] in HexChars + ['X']) and (StrUp [12] in HexChars + ['X'])
  1058.             and (StrUp [13] in HexChars + ['X']) and (StrUp [14] in HexChars + ['X'])
  1059.             and (StrUp [15] = 'H')
  1060.             then
  1061.               ExtendedHeader := #2 + TopicName + #2
  1062.                               + Copy (Str, 16, Length (Str) - 15)
  1063.             else
  1064.             if  (StrUp  [9] in HexChars + ['X']) and (StrUp [10] in HexChars + ['X'])
  1065.             and (StrUp [11] in HexChars + ['X']) and (StrUp [12] in HexChars + ['X'])
  1066.             and (StrUp [13] = 'H')
  1067.             then
  1068.               ExtendedHeader := #2 + TopicName + #2
  1069.                               + Copy (Str, 14, Length (Str) - 13);
  1070.  
  1071.           if  (Copy (StrUp, 1, 4) = 'MSR ')
  1072.           and (StrUp [5] in HexChars + ['X']) and (StrUp [6] in HexChars + ['X'])
  1073.           and (StrUp [7] in HexChars + ['X']) and (StrUp [8] in HexChars + ['X'])
  1074.           and (StrUp [9] in HexChars + ['X']) and (StrUp [10] in HexChars + ['X'])
  1075.           and (StrUp [11] in HexChars + ['X']) and (StrUp [12] in HexChars + ['X'])
  1076.           and (StrUp [13] = 'H')
  1077.           then begin
  1078.             ExtendedHeader := #2 + TopicName + #2
  1079.                             + Copy (Str, 14, Length (Str) - 13);
  1080.           end;
  1081.  
  1082.           if (Copy (StrUp, 1, 7) = 'OPCODE ')
  1083.           then begin
  1084.             for I := 8 to Length (StrUp) do
  1085.               if StrUp [I] = ' ' then Break;
  1086.             if  (I > 8)
  1087.             and (Pos (Copy (StrUp, 8, I - 8), StUpcase2 (TopicName)) > 0) then
  1088.               ExtendedHeader := #2 + TopicName + #2
  1089.                               + Copy (Str, I, Length (Str) - I + 1);
  1090.           end;
  1091.  
  1092.           if  (Copy (StrUp, 1, 5) = 'PORT ')
  1093.           and (StrUp [6] in HexChars) and (StrUp [7] in HexChars)
  1094.           and (StrUp [8] in HexChars) and (StrUp [9] in HexChars)
  1095.           then begin
  1096.             if  (StrUp [10] = '-')
  1097.             and (StrUp [11] in HexChars + ['?']) and (StrUp [12] in HexChars + ['?'])
  1098.             and (StrUp [13] in HexChars + ['?']) and (StrUp [14] in HexChars + ['?', 'x', ' '])
  1099.             then
  1100.               ExtendedHeader := Copy (Str, 15, Length (Str) - 14)
  1101.             else
  1102.               ExtendedHeader := Copy (Str, 10, Length (Str) - 9);
  1103.  
  1104.             ExtendedHeader := #2 + TopicName + #2 + ExtendedHeader;
  1105.           end;
  1106.  
  1107.           if  (ExtendedHeader = #2 + TopicName + #2)
  1108.           and (Str <> '') then
  1109.             ExtendedHeader := #2 + TopicName + #2' ' + Str;
  1110.  
  1111.           if KeyNames. Count > 0 then
  1112.             for I := 0 to KeyNames. Count - 1 do begin
  1113.               J := Pos (StUpcase2 (PString32 (KeyNames. At (I))^), StrUp);
  1114.               if  (J > 0)
  1115.               and ((PTopic (KeyLists. At (I))^. Count = 0)
  1116.                 or (PString (PTopic (KeyLists. At (I))^. At (
  1117.                     PTopic (KeyLists. At (I))^. Count - 1))^
  1118.                  <> ' ' + ExtendedHeader))
  1119.               then begin
  1120.                 PTopic (KeyLists. Items^ [I])^.AddKeyword (OriginalTopicName, 0);
  1121.                 AddStr2Topic (ExtendedHeader,
  1122.                               PTopic (KeyLists. Items^ [I]),
  1123.                               PString (KeyNames. At (I))^, CurInt, CurSubF, CurCat, True);
  1124.               end;
  1125.             end;
  1126.  
  1127.           I := Pos ('TABLE', StrUp);
  1128.           if  (I > 0) and (I + 9 <= Length (Str))
  1129.           and (Str [I + 6] in ['0'..'9', 'C', 'F', 'M', 'R', 'P'])
  1130.           and (Str [I + 7] in ['0'..'9'])
  1131.           and (Str [I + 8] in ['0'..'9'])
  1132.           and (Str [I + 9] in ['0'..'9'])
  1133.           then begin
  1134.             if not TblClosed then begin
  1135.               PrevStr := TblTopic^.At (TblTopic^.Count - 1);
  1136.               if (PrevStr <> nil) and (PrevStr^ <> '') and (PrevStr^ <> ' ') then begin
  1137.                 TblTopic^. AtDelete (TblTopic^.Count - 1);
  1138.                 if PrevStr <> nil then begin
  1139.                   J := Pos (#2, PrevStr^);
  1140.                   while J > 0 do begin
  1141.                     SavePtr := PrevStr;
  1142.                     PrevStr := NewStr (Copy (PrevStr^, 1, J - 1)
  1143.                                + Copy (PrevStr^, J + 1, Length (PrevStr^) - J));
  1144.                     DisposeStr (SavePtr);
  1145.                     J := Pos (#2, PrevStr^);
  1146.                     if J = 0 then
  1147.                       WriteLn ('error 5');
  1148.                     SavePtr := PrevStr;
  1149.                     PrevStr := NewStr (Copy (PrevStr^, 1, J - 1)
  1150.                                + Copy (PrevStr^, J + 1, Length (PrevStr^) - J));
  1151.                     DisposeStr (SavePtr);
  1152.                     TblTopic^. Keywords. AtFree (TblTopic^. Keywords. Count - 1);
  1153.                     J := Pos (#2, PrevStr^);
  1154.                   end;
  1155.                 end;
  1156.               end else
  1157.                 PrevStr := nil;
  1158.  
  1159.               TblTopic^.AddKeyword (OriginalTopicName, 0);
  1160.               AddStr2Topic (ExtendedHeader, TblTopic, TblTopicName, CurInt, CurSubF, CurCat, False);
  1161.               FO. IdxTbl. Insert (New (PIndexEntry, Init (
  1162.                 TblTopicName, '', 0, TblTopic, False)));
  1163.               TblStarted := False;
  1164.               TblClosed := True;
  1165.             end else begin
  1166.               PrevStr := Topic^.At (Topic^.Count - 1);
  1167.               if (PrevStr <> nil) and (PrevStr^ <> '') and (PrevStr^ <> ' ') then begin
  1168.                 Topic^. AtDelete (Topic^.Count - 1);
  1169.                 if PrevStr <> nil then begin
  1170.                   J := Pos (#2, PrevStr^);
  1171.                   while J > 0 do begin
  1172.                     SavePtr := PrevStr;
  1173.                     PrevStr := NewStr (Copy (PrevStr^, 1, J - 1)
  1174.                                + Copy (PrevStr^, J + 1, Length (PrevStr^) - J));
  1175.                     DisposeStr (SavePtr);
  1176.                     J := Pos (#2, PrevStr^);
  1177.                     if J = 0 then
  1178.                       WriteLn ('error 5');
  1179.                     SavePtr := PrevStr;
  1180.                     PrevStr := NewStr (Copy (PrevStr^, 1, J - 1)
  1181.                                + Copy (PrevStr^, J + 1, Length (PrevStr^) - J));
  1182.                     DisposeStr (SavePtr);
  1183.                     Topic^. Keywords. AtFree (Topic^. Keywords. Count - 1);
  1184.                     J := Pos (#2, PrevStr^);
  1185.                   end;
  1186.                 end;
  1187.               end else
  1188.                 PrevStr := nil;
  1189.             end;
  1190.  
  1191.             New (TblTopic, Init (1, 1));
  1192.             TblStarted := True;
  1193.             TblClosed := False;
  1194.             TblTopicName := MakeCorrectTopicName ('#' + Copy (Str, I + 6, 4));
  1195.  
  1196.             if (PrevStr <> nil) and (PrevStr^ <> '') and (PrevStr^ <> ' ')
  1197.             then begin
  1198.               if Pos (#2, PrevStr^) > 0 then begin
  1199.                 WriteLn (PrevStr^);
  1200.                 WriteLn ('error 4');
  1201.               end;
  1202.               AddStr2Topic (PrevStr^, TblTopic, TblTopicName, CurInt, CurSubF, CurCat, False);
  1203.  
  1204.               AddStr2Topic (TblTopicName + PrevStr^, Topic, TopicName, CurInt, CurSubF, CurCat, True);
  1205.               Tables^.AddKeyword (TopicName, 0);
  1206.               AddStr2Topic (TblTopicName + ' '#2 + TopicName + #2
  1207.                           + PrevStr^, Tables, TablesName, CurInt, CurSubF, CurCat, True);
  1208.             end else
  1209.               AddNextStringToTopicAsATblRef := True;
  1210.             DisposeStr (PrevStr);
  1211.  
  1212.             AddStr2Topic (Str, TblTopic, TblTopicName, CurInt, CurSubF, CurCat, False);
  1213.           end else begin
  1214.             if TblStarted then begin
  1215.               if AddNextStringToTopicAsATblRef then begin
  1216.                 AddStr2Topic (TblTopicName + ' ' + Str, Topic, TopicName, CurInt, CurSubF, CurCat, True);
  1217.                 Tables^.AddKeyword (TopicName, 0);
  1218.                 AddStr2Topic (TblTopicName + ' '#2 + TopicName + #2
  1219.                             + ' ' + Str, Tables, TablesName, CurInt, CurSubF, CurCat, True);
  1220.                 AddNextStringToTopicAsATblRef := False;
  1221.               end;
  1222.  
  1223.               AddStr2Topic (Str, TblTopic, TblTopicName, CurInt, CurSubF, CurCat, False);
  1224.             end;
  1225.           end;
  1226.  
  1227.           if not TblStarted then
  1228.             AddStr2Topic (Str, Topic, TopicName, CurInt, CurSubF, CurCat, True);
  1229.         end;
  1230.       end;
  1231.     end;
  1232.  
  1233.     if not TblClosed then begin
  1234.       TblTopic^.AddKeyword (OriginalTopicName, 0);
  1235.       AddStr2Topic (ExtendedHeader, TblTopic, TblTopicName, CurInt, CurSubF, CurCat, False);
  1236.       FO. IdxTbl. Insert (New (PIndexEntry, Init (
  1237.         TblTopicName, '', 0, TblTopic, False)));
  1238.       TblStarted := False;
  1239.       TblClosed := True;
  1240.     end;
  1241.  
  1242.     if not SectionClosed then begin
  1243.       if Pos ('CMOS', StUpcase2 (FileName)) > 0 then begin
  1244.         CMOS^.AddKeyword (OriginalTopicName, 0);
  1245.         AddStr2Topic (ExtendedHeader,
  1246.                       CMOS, CMOSName, CurInt, CurSubF, CurCat, True);
  1247.       end else
  1248.       if Pos ('FARCALL', StUpcase2 (FileName)) > 0 then begin
  1249.         FarCall^.AddKeyword (OriginalTopicName, 0);
  1250.         AddStr2Topic (ExtendedHeader,
  1251.                       FarCall, FarCallName, CurInt, CurSubF, CurCat, True);
  1252.       end else
  1253.       if Pos ('MEMORY', StUpcase2 (FileName)) > 0 then begin
  1254.         Memory^.AddKeyword (OriginalTopicName, 0);
  1255.         AddStr2Topic (ExtendedHeader,
  1256.                       Memory, MemoryName, CurInt, CurSubF, CurCat, True);
  1257.       end else
  1258.       if Pos ('MSR', StUpcase2 (FileName)) > 0 then begin
  1259.         MSR^.AddKeyword (OriginalTopicName, 0);
  1260.         AddStr2Topic (ExtendedHeader,
  1261.                       MSR, MSRName, CurInt, CurSubF, CurCat, True);
  1262.       end else
  1263.       if Pos ('OPCODES', StUpcase2 (FileName)) > 0 then begin
  1264.         OpCodes^.AddKeyword (OriginalTopicName, 0);
  1265.         AddStr2Topic (ExtendedHeader,
  1266.                       OpCodes, OpCodesName, CurInt, CurSubF, CurCat, True);
  1267.       end else
  1268.       if Pos ('PORTS', StUpcase2 (FileName)) > 0 then begin
  1269.         Ports^.AddKeyword (OriginalTopicName, 0);
  1270.         AddStr2Topic (ExtendedHeader,
  1271.                       Ports, PortsName, CurInt, CurSubF, CurCat, True);
  1272.       end else
  1273.       if  (FileIsATopic = '')
  1274.       and ((not (ExtendedHeader [2] in HexChars))
  1275.         or (not (ExtendedHeader [3] in HexChars)))
  1276.       then begin
  1277.         IntList^.AddKeyword (OriginalTopicName, 0);
  1278.         AddStr2Topic (ExtendedHeader,
  1279.                       IntList, IntListName, CurInt, CurSubF, CurCat, True);
  1280.       end;
  1281.  
  1282.       FO. IdxTbl. Insert (New (PIndexEntry, Init (
  1283.         TopicName, '', 0, Topic, IndexThisTopic)));
  1284.       IndexThisTopic := True;
  1285.       SectionClosed := True;
  1286.     end;
  1287.  
  1288.     Close (FI);
  1289.   end else
  1290.     ProcessInterrup := False;
  1291. end;
  1292.  
  1293. var
  1294.   Param: string;
  1295.   C: Char;
  1296.   T: PTopic;
  1297.   I: Integer;
  1298.   KeyFile: Text;
  1299.   KeyStr: string;
  1300.   PKeyStr: PString32;
  1301.  
  1302.   SwapFileSize: Longint;
  1303.  
  1304.   F: file;
  1305.  
  1306. begin
  1307.   WriteLn;
  1308.   WriteLn ('=== Int2TPH Interrupt List Compiler v1.2 Copyright (C) 1996 Slava Gostrenko ===');
  1309.   WriteLn;
  1310.  
  1311.   for I := 1 to ParamCount do begin
  1312.     Param := StUpcase2 (ParamStr (I));
  1313.     if Param [1] in ['/', '\', '-'] then
  1314.       if Pos ('SHORTINDEX', Param) = 2 then
  1315.         ExtendedIndex := False
  1316.       else
  1317.       if Param [2] in ['?', 'H'] then begin
  1318.         WriteLn ('Converts Ralf Brown''s Interrupt List into Borland Turbo Help File (.TPH).');
  1319.         WriteLn;
  1320.         WriteLn ('Usage:   Int2TPH [options]');
  1321.         WriteLn ('Options: /ShortIndex  -  generate a shorter index to make it possible');
  1322.         WriteLn ('         to use the resulting help file with the Turbo Help resident.');
  1323.         Exit;
  1324.       end;
  1325.   end;
  1326.  
  1327.   SwapFileSize := Longint (5120)*1024 - MemAvail;
  1328.   if SwapFileSize > 0 then
  1329.     SwapFileSize := SwapFileSize and (-1024)
  1330.   else
  1331.     SwapFileSize := 0;
  1332.   if SwapFileSize > 0 then begin
  1333.     MemInitSwapFile ('int2tph.swp', SwapFileSize);
  1334.     WriteLn ('swap file size - ', SwapFileSize);
  1335.   end;
  1336.  
  1337.   New (SwapFile, Init ('topics.swp', stCreate, 2048));
  1338.  
  1339.   Hdrs. Init (256, 256);
  1340.  
  1341.   FO. Init ('inter.tph', stCreate, 32768);
  1342.   Assign (IncompPattern, 'incomplt.log');
  1343.   Rewrite (IncompPattern);
  1344.  
  1345.   New (T, Init (1, 1));
  1346.   T^. AddString ('The first topic will be never seen');
  1347.   FO. IdxTbl. Insert (New (PIndexEntry, Init (
  1348.       '', '', 0, T, False)));
  1349.  
  1350.   New (T, Init (16, 16));
  1351.   T^. AddString ('Visit the home page of Slava Gostrenko at http://sunny.aha.ru/~gw/');
  1352.   T^. AddString (' ');
  1353.   T^. AddString ('There  you  may check for the latest versions of Int2TPH and other software.');
  1354.   T^. AddString ('You  can  register  on my page to get automatic notifications when Interrupt');
  1355.   T^. AddString ('List or Int2TPH is updated.');
  1356.   T^. AddString (' ');
  1357.   T^. AddString ('=== ARVID AUDIO ===');
  1358.   T^. AddString (' ');
  1359.   T^. AddString ('is a CD quality digital audio tape recorder made of Sound Blaster sound card');
  1360.   T^. AddString ('and  Arvid  streamer  board.  Arvid is a PC board priced at as little as $60');
  1361.   T^. AddString ('that  makes  a  streamer  of your home video tape recorder. It is capable of');
  1362.   T^. AddString ('storing  2  GigaBytes of data on a single tape. With the help of Arvid Audio');
  1363.   T^. AddString ('software you may record 3 hours of digital audio sound on a regular 180 min.');
  1364.   T^. AddString ('videotape.  Arvid  Audio  records from all audio sources available on(via) a');
  1365.   T^. AddString ('Sound Blaster sound card, e.i. CD player, Microphone, Line In. And now it is');
  1366.   T^. AddString ('capable  of  Direct  Digital Recording From CD! Download it now and you will');
  1367.   T^. AddString ('get 3 hours of 44.1 kHz 16 bit stereo sound on a $2 videotape! Visit my home');
  1368.   T^. AddString ('page for more info and references.');
  1369.   T^. AddString (' ');
  1370.   T^. AddString ('=== ARVID DRAW ===');
  1371.   T^. AddString (' ');
  1372.   T^. AddString ('copies a text file to the TV screen via Arvid. Requires Arvid 1031.');
  1373.   T^. AddString (' ');
  1374.   T^. AddString ('=== CD2WAV ===');
  1375.   T^. AddString (' ');
  1376.   T^. AddString ('is  a  CD-DA  (Digital  Audio)  grabber  with  an advanced jitter correction');
  1377.   T^. AddString ('algorithm.');
  1378.   T^. AddString (' ');
  1379.   T^. AddString ('=== CD2SB ===');
  1380.   T^. AddString (' ');
  1381.   T^. AddString ('is  a  CD-DA (Digital Audio) player that plays CDs via your sound card''s DAC');
  1382.   T^. AddString ('(Digital-to-Analog  Converter)  rather  then  CD-ROM drive''s DAC. So you can');
  1383.   T^. AddString ('compare the quality of the DACs. Requires Sound Blaster SB16.');
  1384.   T^. AddString (' ');
  1385.   T^. AddString ('=== INT2RTF ===');
  1386.   T^. AddString (' ');
  1387.   T^. AddString ('is a program that converts Ralf Brown''s Interrupt List into Rich Text Format');
  1388.   T^. AddString ('(.RTF)  file  that may be further compiled with Microsoft Help Compiler such');
  1389.   T^. AddString ('as  HC31.EXE  to  make  Windows  Help  (.HLP)  file.  Int2RTF uses hypertext');
  1390.   T^. AddString ('features  of  the  Interrupt  List. It is the first (and the only) Interrupt');
  1391.   T^. AddString ('List  compiler that makes a real hypertext of the Interrupt List. It is made');
  1392.   T^. AddString ('possible  due  to  an  advanced  pattern  processing  technique  used in the');
  1393.   T^. AddString ('compiler.  Not  only  it creates comprehensive indexes for all the topics in');
  1394.   T^. AddString ('the list but it also allows users to add their own indexes to the help file.');
  1395.   T^. AddString ('Int2RTF is distributed with source texts!');
  1396.   T^. AddString (' ');
  1397.   T^. AddString ('=== BORLAND PASCAL AUTO CORRECTOR ===');
  1398.   T^. AddString (' ');
  1399.   T^. AddString ('is  a  program  that  makes  it much easier to edit your programs in Borland');
  1400.   T^. AddString ('Pascal''s  IDE. Using expandable dictionary BP Auto Corrector beautifies your');
  1401.   T^. AddString ('sources  on  the fly. Type "tmysuperobject" and look at the screen. You will');
  1402.   T^. AddString ('see "TMySuperObject". And you do not have to press shift keys to type such a');
  1403.   T^. AddString ('nice  identifiers.  AutoSave  feature  will unglue your hands from <F2> key.');
  1404.   T^. AddString ('VideoSubst  feature  will enable Borland Pascal''s IDE to work in video modes');
  1405.   T^. AddString ('others  than 80x25 and 80x50. Now you may set up your BP to work in any text');
  1406.   T^. AddString ('video  mode  that  is  supported  by your video card. You may use VESA video');
  1407.   T^. AddString ('modes  too  and enjoy modes with the resolution up to 132x60! Auto Corrector');
  1408.   T^. AddString ('includes  patches  for BP to make a real full screen editor with no menu and');
  1409.   T^. AddString ('status  lines. It means 2 more lines will be used for displaying your source');
  1410.   T^. AddString ('texts. BP Auto Corrector is distributed with source texts!');
  1411.   T^. AddString (' ');
  1412.   T^. AddString ('=== TICKTOSS ===');
  1413.   T^. AddString (' ');
  1414.   T^. AddString ('is a fileechoprocessor for end-user fidonet systems. TickToss is just a .bat');
  1415.   T^. AddString ('file.  No  .exe''s  or  .com''s.  But it has all the features an end-user ever');
  1416.   T^. AddString ('needs. Automatic creation of new fileechoes with meaningful directory names.');
  1417.   T^. AddString ('Creating  and  updating of area configuration file. Creating and updating of');
  1418.   T^. AddString ('files.bbs''s  in  your  fileecho  areas.  Support  for  long  multilined file');
  1419.   T^. AddString ('descriptions. Logging of performed actions. And all the abovelisted features');
  1420.   T^. AddString ('are implemented as a single .bat file. TickToss requires 4dos or compaitable');
  1421.   T^. AddString ('command processor.');
  1422.   T^. AddString (' ');
  1423.   T^. AddString ('=== VOXEL EARTH ===');
  1424.   T^. AddString (' ');
  1425.   T^. AddString ('It  is  a  demo  of my new real-time voxel 3D engine. Download it and have a');
  1426.   T^. AddString ('virtual  flight over the virtual (but quite realistic) landscape. Pentium or');
  1427.   T^. AddString ('better CPU is recommended.');
  1428.   T^. AddString (' ');
  1429.   T^. AddString ('=== And MORE... ===');
  1430.   T^. AddString (' ');
  1431.   T^. AddString ('Visit my homepage NOW! ;-)');
  1432.   T^. AddString (' ');
  1433.   FO. IdxTbl. Insert (New (PIndexEntry, Init (
  1434.       'http://sunny.aha.ru/~gw/', '', 0, T, True)));
  1435.  
  1436.   for I := Low (IntLists) to High (IntLists) do begin
  1437.     New (IntLists [I], Init (16, 16));
  1438.     IntNames [I] := MakeCorrectTopicName ('INT ' + HexByte (I));
  1439.   end;
  1440.  
  1441.   New (IntListIndex, Init (16, 16));
  1442.   IntListIndexName := MakeCorrectTopicName (' INTERRUPT LIST INDEX ');
  1443.   IntListIndex^.AddString (' ===    This help file was compiled with    ===');
  1444.   IntListIndex^.AddString (' === Int2TPH v1.2 (C) 1996 Slava Gostrenko. ===');
  1445.   IntListIndex^.AddKeyword ('http://sunny.aha.ru/~gw/', 0);
  1446.   IntListIndex^.AddString (' === '#2'http://sunny.aha.ru/~gw/'#2' or gw@aha.ru, ===');
  1447.   IntListIndex^.AddString (' === FidoNet 2:5020/201.105,2:5020/468.105. ===');
  1448.   IntListIndex^.AddString (' ');
  1449.   IntListIndex^.AddKeyword ('TITLES', 0);
  1450.   IntListIndex^.AddString (' '#2'Interrupts'#2);
  1451.  
  1452.   KeyLists. Init (1, 1);
  1453.   KeyNames. Init (1, 1);
  1454.   Assign (KeyFile, 'int_keys.txt');
  1455.   {$I-}
  1456.   Reset (KeyFile);
  1457.   {$I+}
  1458.   if IOResult = 0 then begin
  1459.     while not EOF (KeyFile) do begin
  1460.       ReadLn (KeyFile, KeyStr);
  1461.       if Length (KeyStr) > High (PKeyStr^) then
  1462.         WriteLn ('long key - ', KeyStr)
  1463.       else
  1464.         if KeyStr <> '' then begin
  1465.           KeyLists. AtInsert (KeyLists. Count, New (PTopic, Init (1, 1)));
  1466.           New (PKeyStr);
  1467.           PKeyStr^ := MakeCorrectTopicName (KeyStr);
  1468.           KeyNames. AtInsert (KeyNames. Count, PKeyStr);
  1469.  
  1470.           IntListIndex^.AddKeyword (PKeyStr^, 0);
  1471.           IntListIndex^.AddString (' '#2 + PKeyStr^ + #2);
  1472.         end;
  1473.     end;
  1474.  
  1475.     Close (KeyFile);
  1476.   end;
  1477.  
  1478.   New (IntList, Init (16, 16));
  1479.   IntListName := MakeCorrectTopicName ('Interrupt List Misc. Stuff');
  1480.   IntListIndex^.AddKeyword (IntListName, 0);
  1481.   IntListIndex^.AddString (' '#2 + IntListName + #2);
  1482.  
  1483.   New (Tables, Init (16, 16));
  1484.   TablesName := MakeCorrectTopicName ('Tables');
  1485.   IntListIndex^.AddKeyword (TablesName, 0);
  1486.   IntListIndex^.AddString (' '#2 + TablesName + #2);
  1487.  
  1488.   New (CMOS, Init (16, 16));
  1489.   CMOSName := MakeCorrectTopicName ('CMOS');
  1490.   IntListIndex^.AddKeyword (CMOSName, 0);
  1491.   IntListIndex^.AddString (' '#2 + CMOSName + #2);
  1492.  
  1493.   New (FarCall, Init (16, 16));
  1494.   FarCallName := MakeCorrectTopicName ('Far Calls');
  1495.   IntListIndex^.AddKeyword (FarCallName, 0);
  1496.   IntListIndex^.AddString (' '#2 + FarCallName + #2);
  1497.  
  1498.   New (Memory, Init (16, 16));
  1499.   MemoryName := MakeCorrectTopicName ('Memory');
  1500.   IntListIndex^.AddKeyword (MemoryName, 0);
  1501.   IntListIndex^.AddString (' '#2 + MemoryName + #2);
  1502.  
  1503.   New (MSR, Init (16, 16));
  1504.   MSRName := MakeCorrectTopicName ('Model-Specific Registers');
  1505.   IntListIndex^.AddKeyword (MSRName, 0);
  1506.   IntListIndex^.AddString (' '#2 + MSRName + #2);
  1507.  
  1508.   New (OpCodes, Init (16, 16));
  1509.   OpCodesName := MakeCorrectTopicName ('Opcodes List');
  1510.   IntListIndex^.AddKeyword (OpCodesName, 0);
  1511.   IntListIndex^.AddString (' '#2 + OpCodesName + #2);
  1512.  
  1513.   New (Ports, Init (16, 16));
  1514.   PortSName := MakeCorrectTopicName ('Ports');
  1515.   IntListIndex^.AddKeyword (PortsName, 0);
  1516.   IntListIndex^.AddString (' '#2 + PortsName + #2);
  1517.  
  1518.   ProcessInterrup ('interrup.1st', '');
  1519.   ProcessInterrup ('category.key', '');
  1520.   ProcessInterRUp ('86bugs.lst', '86 Bugs');
  1521.   IntListIndex^.AddKeyword ('86 Bugs', 0);
  1522.   IntListIndex^.AddString (' '#2'86 Bugs'#2);
  1523.   ProcessInterrup ('biblio.lst', '');
  1524.   ProcessInterrup ('cmos.lst', '');
  1525.   ProcessInterrup ('farcall.lst', '');
  1526.   ProcessInterrup ('glossary.lst', 'Glossary of The Interrupt List');
  1527.   IntListIndex^.AddKeyword ('Glossary of The Interrupt List', 0);
  1528.   IntListIndex^.AddString (' '#2'Glossary of The Interrupt List'#2);
  1529.   ProcessInterrup ('memory.lst', '');
  1530.   ProcessInterrup ('msr.lst', '');
  1531.   ProcessInterrup ('opcodes.lst', '');
  1532.   ProcessInterrup ('overview.lst', '');
  1533.   ProcessInterrup ('ports.lst', '');
  1534.   ProcessInterrup ('tables.lst', '');
  1535.   ProcessInterrup ('interrup.pri', 'Interrupt Primer');
  1536.   IntListIndex^.AddKeyword ('Interrupt Primer', 0);
  1537.   IntListIndex^.AddString (' '#2'Interrupt Primer'#2);
  1538.   ProcessInterrup ('rbrown.txt', 'Ralf Brown');
  1539.   IntListIndex^.AddKeyword ('Ralf Brown', 0);
  1540.   IntListIndex^.AddString (' '#2'Ralf Brown'#2);
  1541.  
  1542.   if not ProcessInterrup ('interrup.lst', '') then
  1543.     for C := 'a' to 'z' do
  1544.       if not ProcessInterrup ('interrup.' + C, '') then
  1545.         Break;
  1546.  
  1547.   FO. IdxTbl. Insert (New (PIndexEntry, Init (
  1548.     PortsName, '', 0, Ports, True)));
  1549.  
  1550.   FO. IdxTbl. Insert (New (PIndexEntry, Init (
  1551.     MemoryName, '', 0, Memory, True)));
  1552.  
  1553.   FO. IdxTbl. Insert (New (PIndexEntry, Init (
  1554.     MSRName, '', 0, MSR, True)));
  1555.  
  1556.   FO. IdxTbl. Insert (New (PIndexEntry, Init (
  1557.     OpCodesName, '', 0, OpCodes, True)));
  1558.  
  1559.   FO. IdxTbl. Insert (New (PIndexEntry, Init (
  1560.     FarCallName, '', 0, FarCall, True)));
  1561.  
  1562.   FO. IdxTbl. Insert (New (PIndexEntry, Init (
  1563.     CMOSName, '', 0, CMOS, True)));
  1564.  
  1565.   FO. IdxTbl. Insert (New (PIndexEntry, Init (
  1566.     TablesName, '', 0, Tables, True)));
  1567.  
  1568.   FO. IdxTbl. Insert (New (PIndexEntry, Init (
  1569.     IntListName, '', 0, IntList, True)));
  1570.  
  1571.   if KeyLists. Count > 0 then
  1572.     for I := 0 to KeyLists. Count - 1 do
  1573.       FO. IdxTbl. Insert (New (PIndexEntry, Init (
  1574.         PString32 (KeyNames. At (I))^, '', 0, PTopic (KeyLists. Items^ [I]), True)));
  1575.  
  1576.   FO. IdxTbl. Insert (New (PIndexEntry, Init (
  1577.     IntListIndexName, '', 0, IntListIndex, True)));
  1578.  
  1579.   for I := Low (IntLists) to High (IntLists) do
  1580.     FO. IdxTbl. Insert (New (PIndexEntry, Init (
  1581.       IntNames [I], '', 0, IntLists [I], True)));
  1582.  
  1583.   Close (IncompPattern);
  1584.   FO. Done;
  1585.  
  1586.   WriteLn (Hdrs. Count, ' topics processed.');
  1587.   Hdrs. Done;
  1588.  
  1589.   SwapFile^.Seek (0);
  1590.   SwapFile^.Truncate;
  1591.   Dispose (SwapFile, Done);
  1592.   Assign (F, 'topics.swp');
  1593.   Erase (F);
  1594.  
  1595.   if SwapFileSize > 0 then
  1596.     MemCloseSwapFile (1);
  1597. end.
  1598.